<template>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="活动名称">
      <el-input v-model="form.title"></el-input>
    </el-form-item>
    <el-form-item label="活动区域">
      <el-select v-model="form.address" placeholder="请选择活动区域">
        <el-option
          :label="item.name"
          :value="item.type"
          v-for="(item, idx) in addressList"
          :key="idx"
        ></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="活动时间">
      <el-col :span="11">
        <el-date-picker
          type="date"
          placeholder="选择日期"
          v-model="form.date1"
          style="width: 100%"
          value-format="yyyy-MM-dd"
        ></el-date-picker>
      </el-col>
      <el-col class="line" :span="2">-</el-col>
      <el-col :span="11">
        <el-time-picker
          placeholder="选择时间"
          v-model="form.date2"
          style="width: 100%"
          value-format="HH:mm:ss"
        ></el-time-picker>
      </el-col>
    </el-form-item>
    <el-form-item label="即时配送">
      <el-switch v-model="form.delivery" :active-value="1" :inactive-value="0"></el-switch>
    </el-form-item>
    <el-form-item label="特殊资源">
      <el-radio-group v-model="form.resource">
        <el-radio  :label="0">线上品牌商赞助</el-radio>
        <el-radio :label="1">线下场地免费</el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="活动形式">
      <el-input type="textarea" v-model="form.form"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">立即创建</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: {
    addressList: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      form: {}
    }
  },
  methods: {
    onSubmit() {
      // 自定义方法 传参形式
      this.$emit('getFrom', this.form)
    }
  },
};
</script>